<?php
/**
 * 发送邮件方法
 * 
 * @version 1.0
 * @author wjy
 * @date 2013-03-30
 * */
class ZEmail{
    /**
     * 发送邮件内容
     * @author wjy
     * @version 1.0
     * @date 2013-03-30
     * */
	public function send_email_comment($title,$content='',$nick='')
	{
	    $school_name = isset($content['schoolname'])?$content['schoolname']:'';
	    $school_email = isset($content['email'])?$content['email']:'';
	    $school_mobile = isset($content['mobile'])?$content['mobile']:'';
	    $school_phone = isset($content['home_phone'])?$content['home_phone']:'';
	    
		$emailComment ='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
						  	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
							<html xmlns="http://www.w3.org/1999/xhtml">
							<head>
							<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
							<meta name="Keywords" content="">
							<meta name="Description" content="">
							<title>邮件通知</title>
							<style>
							*{margin:0;padding:0;font-size:12px;word-wrap: break-word;word-break: break-all}
							.ft_14{font-size:14px;}
							.gray{color:#898989}
							.gray_c4{color:#C4C4C4}
							a{color:#007ebf;text-decoration:none}
							a:hover{text-decoration:underline}
							.fix:after{content:'.';display:block;clear:both;visibility:hidden;height:0px}
							.fix{zoom:1}
							.left{float:left;}
							.right{float:right}
							.line{height:0;border-top:1px #E5E5E5 solid;border-bottom:1px #FFFFFF solid;overflow:hidden;margin:25px 0;}
							.box{width:600px;margin:10px auto;background:#FAFAFA;-webkit-box-shadow:2px 2px 10px #C4C4C4;-moz-box-shadow:2px 2px 10px #C4C4C4;box-shadow:2px 2px 10px #C4C4C4;}
							.header{background:#008EC9;padding:2px 40px 0}
							.content{padding:39px;border:1px #D9D9D9 solid;border-top:none}
							.i_code{width:400px;margin:10px 0;line-height:22px;}
							.prg{line-height:34px;}

                            .clearfix{zoom:1;}
                            .ds_blcok{display:block}
                            .pt15{ padding-top:15px;}
                            .pt20{ padding-top:20px;}
                            .pb10{ padding-bottom:10px;}
                            .pb15{ padding-bottom:15px;}
                            .pb20{ padding-bottom:20px;}
                            .fontc_orange_red{color:#D83400}
                            .fontc_333{color:#333}
                            .fontc_444{color:#444}
                            .fontc_999{color:#999}
                            .fonts_14{font-size:14px;}
                            .fonts_16{font-size:16px;}
                            .fonts_22{font-size:22px;}	
                            .fontw_bold{font-weight:bold;}
                            .height22{line-height:22px;}	
                            .m_hr_t{border-top:1px solid #d6d6d6;}
                            .m_hr_b{border-bottom:1px solid #d6d6d6;}				
                            .Mailnotify{width:514px;margin:0 auto;border:1px solid #cdcdcd;padding:20px 57px;}
                            .Mailnotify h1{line-height:80px;text-align:center;}
                            .Mailnotify p{width:514px;line-height:62px;background:#f2faff;text-align:center;margin-bottom:35px;}
                            .Mailnotify ol{width:px;padding-left:49px;background:url(http://www.aa100.com/themes/default/images/module/Public/Mailnotify.png) top left no-repeat;}
                            .Mailnotify .bring{width:514px;text-align:right;}
                            .Mailnotify .bring a{color:#444;}
							</style>
							</head>
							<body screen_capture_injected="true" style="background:#fff;">
                                <div class="Mailnotify">
                                    <h1 class="clearfix fonts_22 fontc_orange_red m_hr_b">欢迎申请[智慧教育数字化校园]！</h1>
                                    <ul class="clearfix fontc_444 height22 pt20">
                                        <li class="fonts_16 fontw_bold">'.$nick.'，你好：</li>
                                        <li class="pb20">感谢您代表'.$school_name.'申请开通智慧教育服务，以下是您提交的注册信息：</li>
                                        <li class="fontw_bold">学校名称：'.$school_name.'</li>
                                        <li class="fontw_bold">学校邮箱：'.$school_email.'</li>
                                        <li class="fontw_bold">联系人手机：'.$school_mobile.'</li>
                                        <li class="fontw_bold">学校固定座机：'.$school_phone.'</li>
                                        <li class="pt20 pb15">我们将在一个工作日内进行审核并和您电话联系。若您有其他疑问请拨打我们的电话进行咨询。</li>
                                    </ul>
                                    <p class="clearfix fonts_16 fontc_orange_red">9516567890转6001 免费电话，周一 至周日 9:00-18:30</p>
                                    <ol class="clearfix height22 pb10">
                                        <li class="fonts_14 fontc_orange_red">数字化校园部署流程： </li>
                                        <li class="fontc_333">第一阶段 学校在线申请</li>
                                        <li class="fontc_999 pb20">最快速接入服务，只需填写学校基本信息，或可以直接致电给我们。</li>
                                        <li class="fontc_333">第二阶段 软件部署</li>
                                        <li class="fontc_999 pb20">通过AA号建立统一账户体系，软件部署采用云服务的互联网模式，AA号直接统一登录，立即使用，方便快捷，不用安装。</li>
                                        <li class="fontc_333">第三阶段 内容导入</li>
                                        <li class="fontc_999 pb20">导入学校部门，教职人员，学生，家长等学校信息。</li>
                                        <li class="fontc_333">第四阶段 硬件部署</li>
                                        <li class="fontc_999 pb20">根据学校情况，实地部署施工安装硬件设施</li>
                                    </ol>
                                  <div class="clearfix bring pt15 m_hr_t"><span class="ds_blcok fontc_444">智慧教育</span><a href="http://www.youxuefu.com" class="ds_blcok">www.youxuefu.com</a></div>
                                </div>
                            </body>
						</html>';
	    return $emailComment;			
	}
	/**
	 *  发送邮件的相关配置
	 *  @author wangjy
	 *　@Param $comment
	 *  @param $sendEmail
	 *  @param $sendTitle(收件人)
	 *  change on 2012-06-08
	 */
	function sendEmail($comment,$sendEmail,$sendtitle)
	{
		$path = Yii::app()->basePath;
		include($path.'/models/external/class.phpmailer.php');
		$mail = new PHPMailer();   
	
		$mail->IsSMTP();       
		$mail->Host = "smtp.exmail.qq.com";          
		$mail->SMTPAuth   = true;       
		$mail->Username   = "905262543@qq.com";      
		$mail->Password   = "wangjinyue617288";          
		$mail->CharSet    = "utf-8";   
		$mail->Subject    = $sendtitle;   
		$mail->SetFrom('905262543@qq.com',"智慧教育");
	
		$body = $comment;	//发送内容 
		$mail->MsgHTML($body);   		
		$mail->AddAddress($sendEmail, $sendtitle); 
		if($mail->Send())
		{
			$email = 1;
		}else{
			$email = 0;	
		}
		return $email; 
	}
}